***********************************************
README for product-bbcode_wrap_SK_RUS_UTF-8.xml
***********************************************

: BB Codes Wrapper in Editor SK /    BB-     
: veressk (SK)
 : 1.0
 : 3.8.x
: UTF-8
: 

: 
     BB-     .   ,      BB-.

: 
          "bbcodeoptimizer" / "Optimize BB Codes and Editor". : https://www.vbulletin.org/forum/showthread.php?t=207423
      BB-       BB-,  (!!!)      php- .
       BB-         BB-   .     php-.

: 
  BB-   "  -  BB-"

    : "  BB-   ->   BB-    :"
 -: 20

       BB-   :
 "   BB-   :"
 -: 

 :

1.  : product-bbcode_wrap_SK_RUS_UTF-8.xml
2.  : includes/functions_editor.php

-------------------------------------------------------------------------------------
:
-------------------------------------------------------------------------------------
function construct_editor_extra_buttons($editorid, $allow_custom_bbcode = true)
{
	global $vbphrase, $vbulletin;

	$extrabuttons = '';

	if ($allow_custom_bbcode)
	{
		foreach ($vbulletin->bbcodecache AS $bbcode)
		{
			if ($bbcode['buttonimage'] != '')
			{
				$tag = strtoupper($bbcode['bbcodetag']);

				$alt = construct_phrase($vbphrase['wrap_x_tags'], $tag);

				$extrabuttons .= "<td><div class=\"imagebutton\" id=\"{$editorid}_cmd_wrap$bbcode[twoparams]_$bbcode[bbcodetag]\"><img src=\"$bbcode[buttonimage]\" alt=\"$alt\" width=\"21\" height=\"20\" border=\"0\" /></div></td>\n";
			}
		}
	}

	return $extrabuttons;
}

-------------------------------------------------------------------------------------
 :
-------------------------------------------------------------------------------------

function construct_editor_extra_buttons($editorid, $allow_custom_bbcode = true)
{
	global $vbphrase, $vbulletin;

	$extrabuttons = '';
	$x = 0;                                                 // SK
	$y = !$vbulletin->options['extbbimagewrap'];            // SK
	$z =  $vbulletin->options['extbbimagewrap'];            // SK 1 = always wrap user bb-codes
  
	if ($allow_custom_bbcode)
	{
		foreach ($vbulletin->bbcodecache AS $bbcode)
		{
			if ($bbcode['buttonimage'] != '')
			{
				if ($z) {$extrabuttons .= "</tr>\n</table>\n"; $z = 0;}                                         // SK
				$x = $x + $y;                                                                                   // SK
				if (!$x) $extrabuttons .= "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n<tr>\n";   // SK
				$x++;                                                                                           // SK

				$tag = strtoupper($bbcode['bbcodetag']);

				$alt = construct_phrase($vbphrase['wrap_x_tags'], $tag);

				$extrabuttons .= "<td><div class=\"imagebutton\" id=\"{$editorid}_cmd_wrap$bbcode[twoparams]_$bbcode[bbcodetag]\"><img src=\"$bbcode[buttonimage]\" alt=\"$alt\" width=\"21\" height=\"20\" border=\"0\" /></div></td>\n";
			
				if ($x >= $vbulletin->options['bbimagewrap'])   // SK
				{                                               // SK
					$x = 0;                                     // SK
					$y = 0;                                     // SK
					$extrabuttons .= "</tr>\n</table>\n";       // SK
				}                                               // SK
      
      }
		}
	}

	return $extrabuttons;
}
